package controllers

import (
	"fmt"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
	"myc/models"
)

type MaoController struct {
	beego.Controller
}
type Respose struct {
	Code int64
	Msg string
	Data  interface{}
}
func (this *MaoController) Get()  {
	this.Ctx.WriteString("你好")
}
func (this *MaoController) Ads()  {
	o := orm.NewOrm()
	user := new(models.User)
	qs := o.QueryTable(user)
	var users []orm.Params
	_,err := qs.Filter("name","毛文科").
		//Filter("id",11).
		Values(&users)
	//err := o.Read(&user)
	if err != nil{
		fmt.Println("找不到主键")
	} else {
		this.Data["json"] = Respose{Code: 200,Msg: "获取成功",Data: &users}
		this.ServeJSON()
	}
	//var maps map[string]int64
	//maps := make(map[string]int64)
	//maps["id"] = id
}
